function myajax(url,data,type,success) {
    //发起ajax异步请求
    //1 创建xhr对象
    var xhr;

    try
    {
        // Firefox, Opera 8.0+, Safari
        xhr=new XMLHttpRequest();
    }
    catch (e)
    {

        // Internet Explorer
        try
        {
            xhr=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {

            try
            {
                xhr=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("您的浏览器不支持AJAX！");
                return false;
            }
        }
    }

    //2 发起请求
    if("GET" == type.toUpperCase()){
        xhr.open(type,url+"?"+data);
        xhr.send();
    }else if("POST" == type.toUpperCase()){
        xhr.open(type,url);
        xhr.setRequestHeader("content-Type","application/x-www-form-urlencoded");
        xhr.send(data);
    }else{
        alert("gg");
        return ;
    }


    let _this = this;
    //3 监听响应
    xhr.onreadystatechange = function(){
        if(xhr.readyState == 4){
            if(xhr.status == 200){
                //alert(xhr.responseText);
                success(xhr.responseText);
            }else{
                console.log(xhr.responseText);
            }
        }
    }
}